package com.acoreful.acf2admin.modules.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TestTask {
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
	@Scheduled(fixedRate = 5000)
	public void reportCurrentTime() {
        System.out.println("The time is now " + dateFormat.format(new Date()));
    }
	@Scheduled(cron = "0/3 * * * * ?")
	public void work() {
		// TODO Auto-generated method stub
		System.out.println(Thread.currentThread().getName() + " "
				+ "work: 每1秒执行一次");

	}
	@Scheduled(initialDelay=5000,fixedDelay=6000)
	public void work1() {
		// TODO Auto-generated method stub
		System.out.println(Thread.currentThread().getName() + " "
				+ "work1: 启动五秒执行开始执行，每6秒执行一次");
		
	}
}
